package com.jiamao.goplay.immsg;

import android.graphics.Color;
import android.text.method.LinkMovementMethod;
import android.text.style.ImageSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jiamao.goplay.R;
import com.netease.nim.uikit.api.NimUIKit;
import com.netease.nim.uikit.business.session.emoji.MoonUtil;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import com.netease.nim.uikit.impl.NimUIKitImpl;

public class MsgViewHolderMatch extends MsgViewHolderBase {

    protected TextView tvTitle,tvName,tvCity,tvNums,tvTime;
    protected ImageView img;

    public MsgViewHolderMatch(BaseMultiItemFetchLoadAdapter adapter) {
        super(adapter);
    }

    @Override
    public int getContentResId() {
        return R.layout.im_msg_item_goto_addr_layout;
    }

    @Override
    public void inflateContentView() {
        img = findViewById(R.id.img_user_photo);
        tvTime = findViewById(R.id.tv_time);
        tvName = findViewById(R.id.tv_name);
        tvCity= findViewById(R.id.tv_city);
        tvNums = findViewById(R.id.tv_num);
        tvTitle = findViewById(R.id.tv_title);

      //  bodyTextView = findViewById(com.netease.nim.uikit.R.id.nim_message_item_text_body);
    }

    @Override
    public void bindContentView() {
        layoutDirection();
//        bodyTextView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                onItemClick();
//            }
//        });
//        MoonUtil.identifyFaceExpression(NimUIKit.getContext(), bodyTextView, getDisplayText(), ImageSpan.ALIGN_BOTTOM);
//        bodyTextView.setMovementMethod(LinkMovementMethod.getInstance());
//        bodyTextView.setOnLongClickListener(longClickListener);
    }

    private void layoutDirection() {
//        if (isReceivedMessage()) {
//            bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageLeftBackground);
//            bodyTextView.setTextColor(Color.BLACK);
//            bodyTextView.setPadding(ScreenUtil.dip2px(15), ScreenUtil.dip2px(8), ScreenUtil.dip2px(10), ScreenUtil.dip2px(8));
//        } else {
//            bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageRightBackground);
//            bodyTextView.setTextColor(Color.WHITE);
//            bodyTextView.setPadding(ScreenUtil.dip2px(10), ScreenUtil.dip2px(8), ScreenUtil.dip2px(15), ScreenUtil.dip2px(8));
//        }
    }

    @Override
    protected int leftBackground() {
        return 0;
    }

    @Override
    protected int rightBackground() {
        return 0;
    }

    protected String getDisplayText() {
        return message.getContent();
    }



    @Override
    protected boolean isMiddleItem() {
        return true;
    }
}
